package com.cqc.manage.util;

import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.lang.Console;
import cn.hutool.extra.mail.MailUtil;
import com.cqc.manage.util.thrift.getBusiness;
import org.apache.thrift.TException;
import org.apache.thrift.protocol.TBinaryProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;
import org.apache.thrift.transport.TTransportException;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;

public class Client {
    //public static void main(String[] args) {
//        //配置服务端的请求信息
//        TTransport transport = new TSocket("127.0.0.1", 9190);
//        try {
//            transport.open();
//            TProtocol protocol = new TBinaryProtocol(transport);
//            getBusiness.Client client = new getBusiness.Client(protocol);
////            TestService.Client client = new TestService.Client(protocol);
//
//            //接口调用
//            List<Map<String, String>> businessList = client.getBusinessList();
//            //打印调用结果
//            System.out.println("java client:" + businessList);
//            transport.close();
//        } catch (TTransportException e) {
//            e.printStackTrace();
//        } catch (TException e) {
//            e.printStackTrace();
//        }


//        String dateStr1 = "2020-01-01";
//        Date date1 = DateUtil.parse(dateStr1);
//
//        String dateStr2 = "2017-04-01 23:33:23";
//        Date date2 = new Date();
//        int year = DateUtil.year(date2);
//
////相差一个月，31天
//        long betweenDay = DateUtil.between(date1, date2, DateUnit.DAY);
//        System.out.println(DateUtil.year(date2));
//    }

    public static void main(String[] args){
//        String dateStr1 = "2017-03-01 22:33:23";
//        Date date1 = DateUtil.parse(dateStr1);
//
//        String dateStr2 = "2017-04-01 23:33:23";
//        Date date2 = DateUtil.parse(dateStr2);
//
////相差一个月，31天
//        long betweenDay = DateUtil.between(date1, date2, DateUnit.DAY);
////        System.err.println(betweenDay);
//
//        long diff = date1.getTime() - date2.getTime();
//        Console.log(diff);

        MailUtil.send("1054117754@qq.com", "43567123452", "邮件来自Springboot_CA的测试", false);
    }

}
